﻿/*
版权所有：版权所有(C) 2011，刘建新
文件编号：M01_Paymentapi.cs
文件名称：Paymentapi.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2011-01-10
作　　者：
内容摘要：表[PaymentApi]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.Bus
{
		/// <summary>
		/// 类 编 号：
		/// 类 名 称：Paymentapi
		/// 内容摘要：
		/// </summary>
		
		[Serializable]
		public class Paymentapi : BaseModel
		{
		#region 自动生成代码
		
			#region 重载Equals/GetHashCode
			/// <summary>
			/// 重载Equals			
			/// </summary>
			public override bool Equals (Object obj)
			{
				if (obj != null && obj is Paymentapi)
				{
					if (obj == this)
						return true;
					Paymentapi castObj = (Paymentapi)obj; 
					
					if (!this.m_Seqno.Equals(castObj.Seqno))
						return false;
						
					if (!this.m_Name.Equals(castObj.Name))
						return false;
						
					if (!this.m_State.Equals(castObj.State))
						return false;
						
					if (!this.m_Logo.Equals(castObj.Logo))
						return false;
						
					if (!this.m_Returnurl.Equals(castObj.Returnurl))
						return false;
						
					if (!this.m_Requesturl.Equals(castObj.Requesturl))
						return false;
						
					if (!this.m_Fee.Equals(castObj.Fee))
						return false;
						
					if (!this.m_Currencytype.Equals(castObj.Currencytype))
						return false;
						
					if (!this.m_Code.Equals(castObj.Code))
						return false;
						
					if (!this.m_Configurl.Equals(castObj.Configurl))
						return false;
						
					return true;
				}
				return false;
			}
			
			/// <summary>
			/// 重载GetHashCode
			/// </summary>
			public override int GetHashCode()
			{
					int hash = 0;					
					
					hash = hash <<  8;
					if ((object)m_Seqno != null)
					{
						hash = hash ^ m_Seqno.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Name != null)
					{
						hash = hash ^ m_Name.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_State != null)
					{
						hash = hash ^ m_State.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Logo != null)
					{
						hash = hash ^ m_Logo.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Returnurl != null)
					{
						hash = hash ^ m_Returnurl.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Requesturl != null)
					{
						hash = hash ^ m_Requesturl.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Fee != null)
					{
						hash = hash ^ m_Fee.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Currencytype != null)
					{
						hash = hash ^ m_Currencytype.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Code != null)
					{
						hash = hash ^ m_Code.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Configurl != null)
					{
						hash = hash ^ m_Configurl.GetHashCode();
					}
						
					return hash; 
			}
			#endregion
			
			public Paymentapi()
			{
				MarkNew();
			}						
			
			public Paymentapi GetOldValue()
			{
				return OldValue as Paymentapi;
			}
		
		#region Seqno属性
			private int m_Seqno = 0;
			/// <summary>
			/// 属性名称： Seqno
			/// 内容摘要： DB列名：Seqno[]
			///            DB类型：int
			/// </summary>
			public int Seqno
			{
				get
					{
						return m_Seqno;
					}
				set
					{
						if (m_Seqno as object == null || !m_Seqno.Equals(value))
						{
							m_Seqno = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Name属性
			private string m_Name = String.Empty;
			/// <summary>
			/// 属性名称： Name
			/// 内容摘要： DB列名：Name[]
			///            DB类型：string
			/// </summary>
			public string Name
			{
				get
					{
						return m_Name;
					}
				set
					{
						if (m_Name as object == null || !m_Name.Equals(value))
						{
							m_Name = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region State属性
			private string m_State = String.Empty;
			/// <summary>
			/// 属性名称： State
			/// 内容摘要： DB列名：State[]
			///            DB类型：string
			/// </summary>
			public string State
			{
				get
					{
						return m_State;
					}
				set
					{
						if (m_State as object == null || !m_State.Equals(value))
						{
							m_State = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Logo属性
			private string m_Logo = String.Empty;
			/// <summary>
			/// 属性名称： Logo
			/// 内容摘要： DB列名：Logo[]
			///            DB类型：string
			/// </summary>
			public string Logo
			{
				get
					{
						return m_Logo;
					}
				set
					{
						if (m_Logo as object == null || !m_Logo.Equals(value))
						{
							m_Logo = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Returnurl属性
			private string m_Returnurl = String.Empty;
			/// <summary>
			/// 属性名称： Returnurl
			/// 内容摘要： DB列名：ReturnUrl[]
			///            DB类型：string
			/// </summary>
			public string Returnurl
			{
				get
					{
						return m_Returnurl;
					}
				set
					{
						if (m_Returnurl as object == null || !m_Returnurl.Equals(value))
						{
							m_Returnurl = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Requesturl属性
			private string m_Requesturl = String.Empty;
			/// <summary>
			/// 属性名称： Requesturl
			/// 内容摘要： DB列名：RequestUrl[]
			///            DB类型：string
			/// </summary>
			public string Requesturl
			{
				get
					{
						return m_Requesturl;
					}
				set
					{
						if (m_Requesturl as object == null || !m_Requesturl.Equals(value))
						{
							m_Requesturl = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Fee属性
			private double m_Fee = 0;
			/// <summary>
			/// 属性名称： Fee
			/// 内容摘要： DB列名：Fee[]
			///            DB类型：double
			/// </summary>
			public double Fee
			{
				get
					{
						return m_Fee;
					}
				set
					{
						if (m_Fee as object == null || !m_Fee.Equals(value))
						{
							m_Fee = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Currencytype属性
			private string m_Currencytype = String.Empty;
			/// <summary>
			/// 属性名称： Currencytype
			/// 内容摘要： DB列名：CurrencyType[]
			///            DB类型：string
			/// </summary>
			public string Currencytype
			{
				get
					{
						return m_Currencytype;
					}
				set
					{
						if (m_Currencytype as object == null || !m_Currencytype.Equals(value))
						{
							m_Currencytype = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Code属性
			private string m_Code = String.Empty;
			/// <summary>
			/// 属性名称： Code
			/// 内容摘要： DB列名：Code[]
			///            DB类型：string
			/// </summary>
			public string Code
			{
				get
					{
						return m_Code;
					}
				set
					{
						if (m_Code as object == null || !m_Code.Equals(value))
						{
							m_Code = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Configurl属性
			private string m_Configurl = String.Empty;
			/// <summary>
			/// 属性名称： Configurl
			/// 内容摘要： DB列名：ConfigUrl[]
			///            DB类型：string
			/// </summary>
			public string Configurl
			{
				get
					{
						return m_Configurl;
					}
				set
					{
						if (m_Configurl as object == null || !m_Configurl.Equals(value))
						{
							m_Configurl = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="tableName">表名</param>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(string tableName,ColumnNameEnum cne)
			{
				DataTable dtResult = new DataTable(tableName);
			
				if (cne == ColumnNameEnum.DBName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Name",typeof(string)));
					dtResult.Columns.Add(new DataColumn("State",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Logo",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ReturnUrl",typeof(string)));
					dtResult.Columns.Add(new DataColumn("RequestUrl",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Fee",typeof(double)));
					dtResult.Columns.Add(new DataColumn("CurrencyType",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ConfigUrl",typeof(string)));
				}
				else if (cne == ColumnNameEnum.PropertyName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Name",typeof(string)));
					dtResult.Columns.Add(new DataColumn("State",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Logo",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Returnurl",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Requesturl",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Fee",typeof(double)));
					dtResult.Columns.Add(new DataColumn("Currencytype",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Configurl",typeof(string)));
				}
				return dtResult;
			}
			
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(ColumnNameEnum cne)
			{
				return CreateDataTable(null,cne);
			}

			/// <summary>
			/// 得到实体对应的DataTable(默认列名映射为属性名)
			/// </summary>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable()
			{
				return CreateDataTable(ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			public void FillDataRow(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				if (ColumnNameEnum.DBName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["Name"] = this.Name;
					dr["State"] = this.State;
					dr["Logo"] = this.Logo;
					dr["ReturnUrl"] = this.Returnurl;
					dr["RequestUrl"] = this.Requesturl;
					dr["Fee"] = this.Fee;
					dr["CurrencyType"] = this.Currencytype;
					dr["Code"] = this.Code;
					dr["ConfigUrl"] = this.Configurl;
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["Name"] = this.Name;
					dr["State"] = this.State;
					dr["Logo"] = this.Logo;
					dr["Returnurl"] = this.Returnurl;
					dr["Requesturl"] = this.Requesturl;
					dr["Fee"] = this.Fee;
					dr["Currencytype"] = this.Currencytype;
					dr["Code"] = this.Code;
					dr["Configurl"] = this.Configurl;					
				}
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow(默认列名映射为属性名)
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			public void FillDataRow(DataRow dr)
			{
				this.FillDataRow(dr,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 将DataRow转换成Paymentapi对象
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			/// <returns>Paymentapi对象</returns>
			public static Paymentapi Dr2Obj(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				Paymentapi obj = new Paymentapi();
				if (ColumnNameEnum.DBName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.Name = (dr["Name"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Name"],typeof(string));
					obj.State = (dr["State"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["State"],typeof(string));
					obj.Logo = (dr["Logo"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Logo"],typeof(string));
					obj.Returnurl = (dr["ReturnUrl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ReturnUrl"],typeof(string));
					obj.Requesturl = (dr["RequestUrl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["RequestUrl"],typeof(string));
					obj.Fee = (dr["Fee"] == Convert.DBNull) ? 0  : (double)Convert.ChangeType(dr["Fee"],typeof(double));
					obj.Currencytype = (dr["CurrencyType"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["CurrencyType"],typeof(string));
					obj.Code = (dr["Code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Code"],typeof(string));
					obj.Configurl = (dr["ConfigUrl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["ConfigUrl"],typeof(string));
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.Name = (dr["Name"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Name"],typeof(string));
					obj.State = (dr["State"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["State"],typeof(string));
					obj.Logo = (dr["Logo"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Logo"],typeof(string));
					obj.Returnurl = (dr["Returnurl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Returnurl"],typeof(string));
					obj.Requesturl = (dr["Requesturl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Requesturl"],typeof(string));
					obj.Fee = (dr["Fee"] == Convert.DBNull) ? 0  : (double)Convert.ChangeType(dr["Fee"],typeof(double));
					obj.Currencytype = (dr["Currencytype"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Currencytype"],typeof(string));
					obj.Code = (dr["Code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Code"],typeof(string));
					obj.Configurl = (dr["Configurl"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Configurl"],typeof(string));		
				}
				
				return obj;
			}
			
			/// <summary>
			/// 将DataRow转换成Paymentapi对象(默认列名映射为属性名)
			/// </summary>
			/// <returns>Paymentapi对象</returns>
			public static Paymentapi Dr2Obj(DataRow dr)
			{
				return Dr2Obj(dr,ColumnNameEnum.DBName);
			}
			
			/// <summary>
			/// 将DataTabe转换成的Paymentapi对象集合
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			/// <returns>Paymentapi对象的集合</returns>
			public static IList Dt2Objs(DataTable dt,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				
				ArrayList alResult = new ArrayList();
				
				foreach(DataRow dr in dt.Rows)
				{
					alResult.Add(Dr2Obj(dr,cne));
				}
				
				return alResult;
			}

			/// <summary>
			/// 将DataTabe转换成的Paymentapi对象集合(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <returns>Paymentapi对象的集合</returns>
			public static IList Dt2Objs(DataTable dt)
			{
				return Dt2Objs(dt,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用objs的Paymentapi对象集合填充DataTable
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">Paymentapi对象集合</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			public static void FillDataTable(DataTable dt,IList objs,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				if (objs == null)
				{
					throw new ArgumentNullException("objs");
				}
				
				foreach(Paymentapi obj in objs)
				{
					DataRow dr = dt.NewRow();
					obj.FillDataRow(dr,cne);
					dt.Rows.Add(dr);
				}
			}

			/// <summary>
			/// 用objs的Paymentapi对象集合填充DataTable(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">Paymentapi对象集合</param>
			public static void FillDataTable(DataTable dt,IList objs)
			{
				FillDataTable(dt,objs,ColumnNameEnum.PropertyName);
			}
		#endregion
		
		/// <summary>
		/// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
		/// </summary>
		public override void CancelEdit()
		{
			Paymentapi old = this.OldValue as Paymentapi;
			if (old != null)
			{
					this.Seqno = old.Seqno;
					this.Name = old.Name;
					this.State = old.State;
					this.Logo = old.Logo;
					this.Returnurl = old.Returnurl;
					this.Requesturl = old.Requesturl;
					this.Fee = old.Fee;
					this.Currencytype = old.Currencytype;
					this.Code = old.Code;
					this.Configurl = old.Configurl;				
				this.OldValue = null;
			}
		}
		
		
		
		
		#region Paymentapi实体的内部Key类
			/// <summary>
			/// Paymentapi实体的Key类
			/// </summary>
			public sealed class Key
			{
		
				private int m_Seqno;
				public int Seqno
				{
 					get 
					{ 
						 return m_Seqno; 
					}
					set 
					{ 
						m_Seqno = value;
					}
				}
		
				public Key(int pSeqno)
				{
					m_Seqno=pSeqno;

				}
			}
		#endregion
			/// <summary>
			/// 得到实体Paymentapi的PK
			/// </summary>
			public Key GetKey()
			{
				return new Key(Seqno);				
			}
			
				
		#endregion
	}
}
